package org.taofuxn.framework.ui.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;

/**
 * Created by wanghuafu on 16/9/15.
 */
public abstract class BaseFragment  extends Fragment{
    private View view ;


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (view == null){
           view = inflater.inflate(setLayoutId(),container,false);
            ButterKnife.inject(this,view);
            init();
        }
        return view;
    }

    protected abstract int setLayoutId();

    protected abstract void init();
}
